fix(intelligence): Phase 5 extractor bugs — runtime crash, ThreadLocal, Go dedup, interface detection#31
Merged
Merged
Conversation
…hCommand builder.getEdges() returns List.copyOf() (immutable). LanguageEnricher.enrich() calls edges.addAll() on it, which would throw UnsupportedOperationException at runtime during language enrichment.
After the ServiceDetector block, enrichedNodes/enrichedEdges were reassigned directly from builder.getNodes()/getEdges() (immutable). Fix the same latent UnsupportedOperationException for any downstream mutation.
ThreadLocal.remove() in finally defeated caching — parser was recreated every call via withInitial anyway. Method-local new JavaParser() is simpler, equally safe on virtual threads, and avoids ThreadLocal overhead.
…portEdges Matches the dedup pattern used in Python and TypeScript extractors. Prevents duplicate IMPORTS edges when a package is matched by both short name and full path. Also fixes lookupUnambiguous to deduplicate by node ID, so that a node stored under multiple registry keys (id, label, full path) is not falsely treated as ambiguous.
…eceiver matching Old pattern matched fabricated Go syntax. New RECEIVER_METHOD regex extracts actual receiver methods from Go source and matches interface labels using Go naming convention (Reader->Read, Closer->Close).
…tion sanitizeRelType was never called anywhere. EnrichCommandTest assertion accepted both 0 and 1 exit codes which tested nothing meaningful.
… + intelligence layer Add intelligence/ package structure, IntelligenceController endpoints, updated pipeline diagram, and key intelligence files to reference table. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…E_METHOD pattern Review found: documented endpoint count was 39 but actual bullet count is 37 (21 GraphController + 9 TopologyController + 4 FlowController + 3 IntelligenceController). Also removed unused INTERFACE_METHOD Pattern constant from GoLanguageExtractor left over after extractInterfaceHints was rewritten to use RECEIVER_METHOD.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
builder.getEdges()/getNodes()innew ArrayList<>()inEnrichCommand— both assignment sites. Was throwingUnsupportedOperationExceptionat runtime whenLanguageEnricher.enrich()calledaddAll()on the immutableList.copyOf()returned byGraphBuilderThreadLocal<JavaParser>fromJavaLanguageExtractor—PARSER.remove()infinallydefeated caching, recreating the parser on every call. Replaced with method-localnew JavaParser()Set<String> seendedup toGoLanguageExtractor.extractImportEdges+ fixlookupUnambiguousto deduplicate by node ID (same node under multiple registry keys was falsely triggering ambiguity guard)String.containsfake-Go-syntax withRECEIVER_METHODregex inGoLanguageExtractor.extractInterfaceHints. Old pattern never matched real Go sourcesanitizeRelTypemethod fromEnrichCommand; fix tautologicalassertTrue(0||1)test assertionCLAUDE.md— 37 endpoints (was 34), 34 MCP tools (was 31), addintelligence/package structure,IntelligenceControllerendpoints, updated pipeline diagram, remove deadINTERFACE_METHODconstantTest Plan
mvn test)enrichedEdgesAreMutableForLanguageEnrichercovers the immutable list fixextract_samePkgMatchedByNameAndPath_noDuplicateEdgescovers Go edge dedupextract_realGoReceiverSyntax_detectsInterfaceSatisfactioncovers Go receiver regex🤖 Generated with Claude Code